package com.syezon.wifikey.wifi.dialog;

import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.text.Editable;
import android.text.InputType;
import android.text.TextWatcher;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.syezon.android.base.utils.ToastUtils;
import com.syezon.wifikey.R;
import com.syezon.wifikey.utils.GpsUtil;
import com.syezon.wifikey.wifi.WiFiConnectDialog;
import com.syezon.wifikey.wifi.info.WifiInfo;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Administrator on 2018/9/11.
 */

public class GpsGuideDialog extends Dialog {

    public static void enterPwd(Context context) {
        GpsGuideDialog enterPwdDialog = new GpsGuideDialog(context);
        enterPwdDialog.show();
    }

    public GpsGuideDialog(@NonNull Context context) {
        this(context, 0);
    }

    public GpsGuideDialog(@NonNull Context context, int themeResId) {
        super(context, themeResId);
        requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉title，在有的手机dialog顶部会出现空白
        setContentView(View.inflate(context, R.layout.app_wifi_gps_guide_dialog, null));
        ButterKnife.bind(this);
        // 设置弹出窗体的宽和高
        setCanceledOnTouchOutside(true);
        setCancelable(true);
        Window window = getWindow();
        window.setLayout(WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT);
        window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    }


    @OnClick({R.id.tv_open_gps})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.tv_open_gps:
                openGps();
                dismiss();
                break;
        }
    }

    private void openGps() {
        Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
        getContext().startActivity(intent);
    }
}
